#include <iostream>
using namespace std;
int main()
{
	string str1 = "", str2 = "";
	cin >> str1 >> str2;
	int n1 = str1.size(), n2 = str2.size();
	int res = -1;
    
	for (int i = 0; i < n1; ++i)
	{
		for (int j = 0; j < n2; ++j)
		{
			int cnt = 0;
			int tmpi = i, tmpj = j;
			while (tmpi < n1 && tmpj < n2 && str1[tmpi++] == str2[tmpj++])
			{
				++cnt;
			}
			res = max(res, cnt);
		}
	}
	cout << res << endl;
	return 0;
}